home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 112 / EnigmaAmiga112CD.iso / dalla rivista / awnpipe / awnp / awnp-docs / texample.doc < prev    next >
Text File  |  2000-05-18  |  3KB  |  67 lines

  1.  
  2. Now for some strange looking but powerful ideas. You don't have to understand them all just give them a try. Some interesting things can be done by setting a few simple aliases. Some of these aliases take advantage of AWNPipes GUI building feature covered in a different section of these docs.
  3.  
  4. alias see  echo >awnpipe:/xc "defg*nbitmap fn []*nimage*nopen"
  5.  
  6. Now 'see FILENAME' will display pictures using your datatypes.
  7.  
  8. alias readtext  echo >awnpipe:/xc "defg a cs *ntextfield a minw 200 minh 200 gt 0 bd ro datain []*nopen"
  9.  
  10. Now 'readtext FILENAME' will display a textfile.
  11.  
  12. alias toolt  type awnpipe:/xi[]
  13.  
  14. Now 'toolt FILENAME' will display the tooltypes of FILENAME. (do not include .info in FILENAME).
  15.  
  16. alias text2html copy awnpipe:t2h/f/h/r[]
  17.  
  18. Now 'text2html infile outfile' will create special html sequences for certain characters in a text file and save it in a new file.
  19.  
  20. alias html2text copy awnpipe:t2h/f/u/r[]
  21.  
  22. Now 'html2text infile outfile' will convert special HTML sequences in a html file and save it in a new file.
  23.  
  24. ---
  25.  
  26. This next example is rather complex and is best studied after you have a working knowledge of AWNP.
  27.  
  28. It might be useful to be able to check an icons tooltype from an ADOS script, as earlier examples
  29. have shown the '/Xt' option can do this. There is a problem however. You need to write data to the
  30. pipe (the tooltype you wish to check), and read data from the pipe (the response to your query).
  31.  
  32.  It is simple to write data to the pipe with echo.
  33.  
  34. 'echo "filetype" >awnpipe:test/Xtpath:file'
  35.  
  36.  A pipe connected to path:file.icon is opened and the data 'filetype' is written to it. When the echo
  37. command completes it closes the pipe. This breaks the connection to the tooltype host and the host
  38. exits. You do not get a chance to read the response from the host.
  39.  
  40.  The '/m' option (multiple opens) solves this by allowing you to open the pipe connection to the
  41. tooltype host more than once.
  42.  
  43.  'echo "filetype" >awnpipe:test/m/Xtpath:file'
  44.  
  45.  Again a pipe is connected to the tooltype host is created and sent data. This time however when echo
  46. closes its pipe the connection to the host is not lost. AWNPipe knows you want to connect to the same
  47. pipe again later.
  48.  
  49.  'type awnpipe:test'
  50.  
  51.  This reads the response back from the tooltype host. Note you only specified the pipe name, you do
  52. NOT include '/Xtpath:file' again. When the type command completes the connection to the host is broken
  53. and the host exits.
  54.  
  55.  This idea can be taken a step further.
  56.  
  57.  'echo "filetype" >awnpipe:test/m/Xtpath:file'
  58.  'type awnpipe:test/m'
  59.  'echo "filesize" >awnpipe:test/m'
  60.  'type awnpipe:test/m'
  61.  'echo "filedate" >awnpipe:test/m'
  62.  'type awnpipe:test'
  63.  
  64. The connection to the host is not broken until you finally open the pipe a last time without the '/m'
  65. option.
  66.  
  67.